<!DOCTYPE html>
<!--suppress ALL-->
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>comprehensive</title>
    <!--外部资源通用-->
    <th:block th:fragment="resource">
        <link rel="shortcut icon" th:href="@{/favicon.ico}">
        <link rel="bookmark" th:href="@{/favicon.ico}">
        <script th:src="@{/js/jquery-3.3.1.min.js}"></script>
        <script th:src="@{http://code.jquery.com/jquery-migrate-1.2.1.js}"></script>
        <link type="text/css" rel="stylesheet" th:href="@{/lib/layui/css/layui.css}">
        <script th:src="@{/lib/layui/layui.js}"></script>
        <script th:src="@{/js/jquery.ztree.all-3.5.js}"></script>
        <script th:src="@{/js/jquery.ztree.core-3.5.js}"></script>
        <link type="text/css" rel="stylesheet" th:href="@{/css/zTreeStyle/zTreeStyle.css}">
        <link type="text/css" rel="stylesheet" th:href="@{/css/login.css}">
        <link type="text/css" rel="stylesheet" th:href="@{/css/main.css}">
        <script th:src="@{/js/main.js}" type="text/javascript"></script>
        <link th:href="@{/css/modules/dtree.css}" rel="stylesheet" type="text/css"/>
        <link th:href="@{/css/dtreefont.css}" rel="stylesheet" type="text/css"/>
        <script th:src="@{/lib/layui/lay/modules/textool/textool.min.js}" type="text/javascript"></script>
    </th:block>
</head>
<body>
<th:block th:fragment="top">
    <div>
        <ul class="layui-nav">
            <li class="layui-nav-item">
                <a href=""><span style="color: #00FFFF">管理员：</span>
                    <span th:text="${admin.getUsername()}"></span>
                </a>
            </li>
            <span><button id="logoutButton" class="layui-btn layui-btn-danger" style="float: right;margin-top: 12px">退出登录</button></span>
        </ul>
    </div>
    <script>
        layui.$(function (){
            $("#logoutButton").on('click',function (){
               $.ajax({
                   url:"/admin/api/logout",
                   method:"POST",
                   success:function (result){
                       layer.msg("退出成功！", {shade: 0.3, time: 2000, icon: 1});
                       setTimeout(function () {
                           window.location.href="/admin/login";
                       },1000);
                   },
                   error:function (){
                       layer.msg("退出失败，请联系管理员！", {shade: 0.3, time: 2000, icon: 1});
                   }
               }) ;
            });
        });
    </script>
</th:block>
</body>
</html>